package com.googlecode.continuity.plugin.gwtext.client;

import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.SourcesTabEvents;
import com.google.gwt.user.client.ui.Widget;

/**
 * TabBar
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public interface TabBar extends EventListener, HasPosition, SourcesTabEvents, ClickListener {
  void addTab(String text);

  /**
   * Inserts a new tab at the specified index.
   *
   * @param text        the new tab's text
   * @param beforeIndex the index before which this tab will be inserted
   */
  void insertTab(String text, int beforeIndex);

  int getTabCount();

  void addTab(Widget widget);

  /**
   * Inserts a new tab at the specified index.
   *
   * @param widget      widget to be used in the new tab.
   * @param beforeIndex the index before which this tab will be inserted.
   */
  void insertTab(Widget widget, int beforeIndex);

  void addTab(String text, boolean asHTML);

  /**
   * Inserts a new tab at the specified index.
   *
   * @param text        the new tab's text
   * @param asHTML      <code>true</code> to treat the specified text as HTML
   * @param beforeIndex the index before which this tab will be inserted
   */
  void insertTab(String text, boolean asHTML, int beforeIndex);

  int getSelectedTab();

  /**
   * Gets the specified tab's HTML.
   *
   * @param index the index of the tab whose HTML is to be retrieved
   * @return the tab's HTML
   */
  String getTabHTML(int index);

  boolean selectTab(int index);

  /**
   * Removes the tab at the specified index.
   *
   * @param index the index of the tab to be removed
   */
  void removeTab(int index);

  void setSelectionStyle(Widget item, boolean selected);

  void checkInsertBeforeTabIndex(int beforeIndex);

  void checkTabIndex(int index);

  boolean isHorizontal();

  boolean isVertical();
}
